<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match='Estructura' name="busqueda">
		<xsl:param name="criterio"/>
		<xsl:param name="txtBusqueda"/>
		
		<div id="busqueda">
			<script src="Scripts/Impresion.js"></script>
			<form>
			<xsl:attribute name="name">frmBusqueda</xsl:attribute>
			<xsl:attribute name="id">frmBusqueda</xsl:attribute>
			<xsl:attribute name="method">POST</xsl:attribute>
			<xsl:attribute name="action"><xsl:value-of select="//Consulta/@url"/></xsl:attribute>
			<p align="center">
			<!--Imprimir<input type="checkbox" id="chkImprimir" />-->
			<div id="btnImp" align="left"><input width="50" type="button" value="Impresion" onclick="irVistaImpresion();"/></div>
			Criterio:<select name="criterio">
				<xsl:for-each select="//Estructura/Campo">
					<xsl:if test="@Oculto-Listado = 0">
					<option>
						<xsl:attribute name="value"><xsl:value-of select="@Id"/></xsl:attribute>
						<xsl:if test="$criterio = @Id">
							<xsl:attribute name="selected">selected</xsl:attribute>
						</xsl:if>
						<xsl:if test="@Alias = ''">
							<xsl:value-of select="@Nombre" />
						</xsl:if>
						<xsl:if test="@Alias != ''">
							<xsl:value-of select="@Alias" />
						</xsl:if>
					</option>
					</xsl:if>
				</xsl:for-each>
			</select>
			<input type="text" name="txtBusqueda" maxlength="100">
				<xsl:if test="$txtBusqueda != ''">
					<xsl:attribute name="value"><xsl:value-of select="$txtBusqueda"/></xsl:attribute>
				</xsl:if>
			</input>
			<link href="Scripts/calendario.css" type="text/css" rel="stylesheet" />
			<script type="text/javascript" src="Scripts/calendario.js"></script>
			<input type="button">
				<xsl:attribute name="name"><xsl:value-of select="concat('btn',@Id)" /></xsl:attribute>
				<xsl:attribute name="value">...</xsl:attribute>
				<xsl:attribute name="onclick">displayDatePicker('txtBusqueda');</xsl:attribute>
				<xsl:if test="//Estructura/Campo[@Id=current()/@Id]/@Solo-Lectura='1' or //Consulta/@op='borrar' or //Consulta/@op='negar'">
					<xsl:attribute name="disabled">true</xsl:attribute>
				</xsl:if>
			</input>
			<input type="button" value="Buscar">
				<xsl:attribute name="onClick">
					document.getElementById('frmBusqueda').submit();
				</xsl:attribute>
			</input>
			<input value="Limpiar" type="button">
				<xsl:attribute name="onClick">document.location = document.location;</xsl:attribute>
			</input>
			
			<input type="hidden" name= "sel" >
					<xsl:attribute name="value"><xsl:value-of select="//Consulta/@Nombre"></xsl:value-of></xsl:attribute>
				</input>
			</p>
			</form>
		</div>
	</xsl:template>
</xsl:stylesheet>